package com.chehejia.devmng.platform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chehejia.devmng.platform.domain.CvLaPlan;
import com.chehejia.devmng.platform.persistence.CvLaPlanMapper;
import com.chehejia.devmng.platform.service.CvLaPlanService;
import com.chehejia.devmng.platform.util.EmptyUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 长期调配-指标计划表 服务实现类
 * </p>
 *
 * @author chj-auto
 * @since 2018-12-13
 */
@Service
public class CvLaPlanServiceImpl extends ServiceImpl<CvLaPlanMapper, CvLaPlan> implements CvLaPlanService {

    @Override
    public List<CvLaPlan> queryListByYearAndSpu(int year, String spuCode) {
        LambdaQueryWrapper<CvLaPlan> lambda = new QueryWrapper<CvLaPlan>().lambda();
        if (EmptyUtil.isNotEmpty(year)){
            lambda.eq(CvLaPlan::getYear,year);
        }
        if (EmptyUtil.isNotEmpty(spuCode)){
            lambda.eq(CvLaPlan::getSpuCode,spuCode);
        }
        return this.list(lambda);
    }

//    @Override
//    public boolean create(CvLaPlan laPlan) {
//        return create(laPlan);
//    }
}
